<template>
    <view class="container">
        <header-nav :config="config" :indexTab="1" @tabChange="tabChange" @rightClick="rightClick"></header-nav>
        <view class="main">
            <pendingList ref="pendingList" :height="listHeight"></pendingList>
        </view>
    </view>
</template>

<script>
import headerNav from "../../components/header-nav.vue"
import pendingList from "@/pages_tms/components/order/pending-list.vue"
import { getElementHeight } from "@/uni-sub-base/utils/elementUtil.js"
export default {
    components: {
        headerNav,
        pendingList,
    },
    props: {
        visible: {
            type: Boolean,
            default: true,
        },
        selectType: {
            type: String,
            default: "",
        },
    },
    watch: {
        visible: {
            handler(newVal) {
                this.$nextTick(() => {
                    this.getListHeight()
                })
            },
            immediate: true,
        },
    },
    data() {
        return {
            listHeight: "",
            loadOk: false,
            config: {
                backPage: "/pages/index/index",
                centerSlot: true,
                rightSlot: false,
                color: ["#333333"],
                statusBarFontColor: "#ffffff",
                rightBtns: [],
                tabs: [
                    {
                        title: "配送", // tppe 2
                    },
                    {
                        title: "接单", // tppe 3
                    },
                ],
            },
        }
    },
    created() {
        let mainColor = this.easyGetColor("white")
        this.config.backgroundColor = [1, mainColor]
    },
    mounted() {},
    onShow() {},
    methods: {
        //获取列表高度
        getListHeight() {
            //获取商品高度
            getElementHeight(this, ".main", (e) => {
                this.listHeight = e + "px"
                this.loadOk = true
            })
        },
        tabChange(e) {
            if (e == 0) {
                this.easyGoTo("/pages_tms/packet/order/list")
            } else if (e == 1) {
                return
            }
        },
    },
}
</script>

<style lang="scss">
page {
    background: #f6f6f8;
}
</style>
